(function () {
    'use strict';

    angular
        .module('logcenterApp')
        .service('deployDashService',deployDashService);

    deployDashService.$inject=['$http','$q'];
    function deployDashService($http,$q) {


        var queryOnlineSort = function (beginDateTime, endDateTime,active) {
            var deferred=$q.defer();
            $http.get('api/deployDash/onlineSort?startTime='+ beginDateTime + '&endTime=' + endDateTime+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        var queryOnlineTrend = function (beginDateTime, endDateTime,interval,active) {
            var deferred=$q.defer();
            $http.get('api/deployDash/onlineTrend?startTime='+ beginDateTime + '&endTime=' + endDateTime+'&interval='+interval+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        return {

            queryOnlineSort:queryOnlineSort,
            queryOnlineTrend:queryOnlineTrend

        };
    }
})();
